package com.woniu.car.config;

import com.alipay.easysdk.factory.Factory;
import com.alipay.easysdk.kernel.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName AliPay
 * @Description TODO
 * @Author 李磊
 * @Version 1.0
 **/
@Configuration
public class AliPay {

    @Bean
    public Config getOptions() {
        Config config = new Config();
        config.protocol = "https";
        config.gatewayHost = "openapi.alipaydev.com";
        config.signType = "RSA2";

        config.appId = "2021000117666443";

        // 为避免私钥随源码泄露，推荐从文件中读取私钥字符串而不是写入源码中
        config.merchantPrivateKey = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCsw8dTJQ1YcxovA69dHo2kioaZHwwAyaN927/B5dI9bJk1r2abz62nerhD2F4/8X7QnJ+91fKnvqed9nT2kLiveh3Co9CxIIC3X3CeyFrjNQf1HUyp4vG13gzl9WPylc4U8PYk+Sk2KLyNIE+/2TWJbwyDoxzFoGiu+3ExPR6Qv+PEiLoUKy5poSMO8acpbjxiUuI3paUchHgxwkZTEtqUwCwg35D9hPUSKUj26Pht0E3OIUPJ94bf5WNGKIzgZX2dMk1Jua0+zywIMzIQWZRGyBXVruOPPU8rH16nHmd/JrA4kJCNLzDoSUOtEUSAXEAEjV80D+dDPCrHNgSMtEITAgMBAAECggEBAKboQeKW0kzYbrxrD/mjse38EstNzlfYdkX6jkiyUqobB+1wtm3jdv5ttiV9nJikJANAvac2UkczD1axqxAmgvaswKGxh8YIA7Kk1vXf1MbbDgQFuXILmb89djKYH2ZWyhE7NmJEAUeclYS2abWMEIflLC7k38AiF+CtdQ6/4I6v5neNqH3ZhfIRiVrVUa5Pj3p/Xmg2KA3Bnnbl/+0Y9RhIZuEASnwyAeamUubN43SWZf2OT8oJ7PkO/PiPqjjbEtmARrFjzRZqzW/FJWlBLiimKhs9vPiITPY4hJN3lRHiBr8WUu1Nk/B3+HPxwcSFz7pjN88rOhkUnYQoxUw/mJECgYEA/qsx7DJ2XsuGk6jHPJdnuKakJKOnmhWf+R8yoQah63qDvsI34o5dlBNEYF+N8ty81aVJ7iucoUd86W2hWwkd3R5J/8NfsY+K1RWE1CPIjMy8xwREBTMYVRtR2Yyt2MB4MOATdLCMwcoQZ5e9l72GH9K0vycxkrCbjG2gZ8QVPzkCgYEArar6NHcxuIMNYqzHXbfkz4lGkvKO6Z4g6gXsi3IMUgIUWongftrhgKsFAYJpiDHm5/XYnFifMRhyWXonzXTYVTpTK3xe5diU4uZMWmWQLa6toEzvpRX58TV54raYKdGakMq8N1qFFTtXlsL+JxO+e9SpOZ7Sjy7O5T3ZtiOUP6sCgYAi3DZSObogUcXTMphLQAJvsUfoyAoqOmmShWW9yxWhET01gIp71bcTjOugMZRRuUuUBzMuigO/w/RiU6Jxvra6zOmePBU+TgLYFkD/dQJ/24q/x2K0P4FGLR4wJGSrtfT9475mC8DIyisisw+91LCmbIZXYDsV9FzmhR8e9SVfaQKBgBCXVgHvJTPgaUX1BbLhX52oGrLtM1QERFa3LCsCQUUQZ8tigqz70jFNpVPIlrZpNgsRBJmjKcox8LK1pdnOAODbipiL8DD7KPYoVEEKlOSYXIQE9ZwK5m7x0ewjz5OnL6IHjEWpgy9NFQgVJtyq2TbRUT1s++ar7R4fc44gBgizAoGBAORHAQGSsQH+59bXHnsPdRFORu/3Df7VvjxGUngOtUIOnpME/HfnezBV3HJ2bjK18zOFFuOlEJ0l/zAGNfXRXcBp59sUiT1c3gWLqM5XfeLOlBQNAddwI2YfJIDKdW+b3rdnyX3KvR33+Ja5cFA9fxwZ1/W/Utb4C7WfDPwSr5g8";

        //注：证书文件路径支持设置为文件系统中的路径或CLASS_PATH中的路径，优先从文件系统中加载，加载失败后会继续尝试从CLASS_PATH中加载
//        config.merchantCertPath = "<-- 请填写您的应用公钥证书文件路径，例如：/foo/appCertPublicKey_2019051064521003.crt -->";
//        config.alipayCertPath = "<-- 请填写您的支付宝公钥证书文件路径，例如：/foo/alipayCertPublicKey_RSA2.crt -->";
//        config.alipayRootCertPath = "<-- 请填写您的支付宝根证书文件路径，例如：/foo/alipayRootCert.crt -->";

        //注：如果采用非证书模式，则无需赋值上面的三个证书路径，改为赋值如下的支付宝公钥字符串即可
         config.alipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiavxZEDL6OogyOqbGVabilF1B+gZrhROj8ziRms9uteKcIeB8eDTuuEMHxVj73y5CcAgAYzeJ4Ah9yHf3LGUWTZhqdziH6wfxDUrp/1g1c0gLsijcyWuvkMD0ouzUNSgIDteH9bLxcyY9WzUvkJmuKs953zuKi1eSj4q27GTWTeOJ6Kbvw4vaDu48ugVRHhJw4cwFMngW38CRC0TOf6v7LV5u3DwdEKzj6PAuZLO49DT3HR9xS9Dw1h6BzX9EcxZd4fhdUwwNf0Hq+NdB5QK0boK1iyODZyl9+vkPLhXtyRuBrx2E1b8a1PmV3pUuDlnWpq4l4DxfINHUwRdKhBMjwIDAQAB";

        //可设置异步通知接收服务地址（可选）
        config.notifyUrl = "www.baidu.com";

        //可设置AES密钥，调用AES加解密相关接口时需要（可选）
//        config.encryptKey = "<-- 请填写您的AES密钥，例如：aa4BtZ4tspm2wnXLb1ThQA== -->";
        Factory.setOptions(config);
        return config;
    }

}
